package com.myjava.collection;

import java.util.ArrayList;
import java.util.Collection;
class Person{
    String name;
    int age;
}
@SuppressWarnings("ALL")
public class CollectionDemo1 {
    class add{

    }
    public static void main(String[] args) {
        //多态写法，用父类创建子类对象，/面向接口  实现子类特性
        Collection c = new ArrayList();//创建一个数组，可以添加元素
        boolean b1 = c.add("abc");
        boolean b2 = c.add(10);
        boolean b3 = c.add(true);
        Person p = new Person();
        p.name = "jingyanhe";
        p.age = 18;
        boolean add = c.add(p);
        boolean b4 = c.add(p.name);
        boolean b5 = c.add(p.age);
        System.out.println(c);
      Collection c2 = new ArrayList();
      c2.add("a");
      c2.add("b");
      c2.add("c");
        System.out.println(c2.size());
        System.out.println(c2.isEmpty());

        System.out.println(c2.remove("b"));
        System.out.println(c2);
       c2.clear();
        System.out.println(c2);

    }
}
